<!DOCTYPE html>
<html ng-app="myApp">
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../AngularJS-1.4.1/js/angular.js"></script>
		<script src="../AngularJS-1.4.1/js/angular-route.js"></script>
	</head>
	<body ng-controller="indexCtrl">
		<!--存放路由加载页面的容器-->
		<div ng-view></div>
		
	</body>
	<script>
		//创建声明的模块
		var app = angular.module('myApp',['ng','ngRoute'])
		
		//路由配置词典
		app.config(function($routeProvider){
			$routeProvider
				.when('/tpl/login',{
					templateUrl:'tpl/login.html',
					controller:'loginCtrl'
				})
				.when("/tpl/main",{
					templateUrl:'tpl/main.html',
					controller:'mainCtrl'
				})
				.otherwise({
					redirectTo:'/tpl/login'			
				})			
		})
		 
		//首页控制器
		app.controller('indexCtrl',['$scope','$location',function($scope,$location){
			$scope.jump = function(url){
				$location.path(url);				
			}			
		}])
		
		//登录页面控制器
		app.controller('loginCtrl',function($scope){
			$scope.mun="10";
		})
		
		//主页页面控制器
		app.controller('mainCtrl',function($scope){
			$scope.tetx="我只主页控制器的内容";
		})
		
		
	</script>
	
</html>
